using System.Collections.Generic;

namespace MultiplayerServerDiscoveryHandlers
{
	internal static class ServerListExtensions
	{
		public static void RemoveByEndpoint(this List<Server> servers, GGIPAddress address, int port)
		{
			for (int num = servers.Count - 1; num >= 0; num--)
			{
				if (servers[num].serverAddress.Equals(address) && servers[num].port == port)
				{
					servers.RemoveAt(num);
				}
			}
		}

		public static bool ContainsEndpoint(this List<Server> servers, GGIPAddress address, int port)
		{
			foreach (Server server in servers)
			{
				if (server.serverAddress.Equals(address) && server.port == port)
				{
					return true;
				}
			}
			return false;
		}
	}
}
